<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>宽屏优化器</title>
    <style>
        /* 基础样式 */
        body {
            width: 320px;
            margin: 0;
            padding: 20px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            color: #2c3e50;
            background: #f8f9fa;
            overflow: hidden;
        }

        .container {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            max-height: 500px;
            overflow-y: auto;
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE and Edge */
        }

        .container::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Opera */
        }

        h1 {
            font-size: 24px;
            margin: 0 0 20px 0;
            color: #1a73e8;
            text-align: center;
            font-weight: 600;
        }

        /* 模式切换滑块 */
        .mode-switch {
            background: #f1f3f4;
            border-radius: 8px;
            padding: 4px;
            position: relative;
            margin-bottom: 24px;
            height: 40px;
            display: flex;
            align-items: center;
        }

        .mode-switch input {
            display: none;
        }

        .mode-slider {
            position: absolute;
            top: 4px;
            left: 4px;
            background: white;
            border-radius: 6px;
            height: calc(100% - 8px);
            width: calc(50% - 4px);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        input:checked ~ .mode-slider {
            transform: translateX(100%);
        }

        .mode-labels {
            position: relative;
            z-index: 1;
            display: flex;
            width: 100%;
        }

        .mode-label {
            flex: 1;
            text-align: center;
            padding: 10px;
            cursor: pointer;
            font-weight: 500;
            font-size: 14px;
            color: #5f6368;
            transition: color 0.3s ease;
            user-select: none;
        }

        input:checked ~ .mode-labels .mode-label:last-child,
        input:not(:checked) ~ .mode-labels .mode-label:first-child {
            color: #1a73e8;
        }

        /* 控制组样式 */
        .control-group {
            margin-bottom: 20px;
            padding: 16px;
            background: #f1f3f4;
            border-radius: 8px;
        }

        .control-group label {
            display: block;
            margin-bottom: 12px;
            font-size: 16px;
            font-weight: 500;
            color: #202124;
        }

        .control-group input[type="number"] {
            width: 100%;
            padding: 12px;
            font-size: 16px;
            border: 2px solid #dadce0;
            border-radius: 6px;
            background: white;
            color: #202124;
            transition: all 0.2s ease;
            box-sizing: border-box;
        }

        .control-group input[type="number"]:focus {
            border-color: #1a73e8;
            outline: none;
            box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
        }

        /* 按钮组样式 */
        .control-button-group {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-top: 24px;
        }

        button {
            padding: 12px 16px;
            font-size: 15px;
            font-weight: 500;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: center;
            white-space: nowrap;
        }

        #addToOptimizeList {
            background: #1a73e8;
            color: white;
            box-shadow: 0 2px 4px rgba(26, 115, 232, 0.3);
        }

        #addToOptimizeList:hover {
            background: #1557b0;
            box-shadow: 0 4px 8px rgba(26, 115, 232, 0.4);
            transform: translateY(-1px);
        }

        #addToWhitelist {
            background: #f1f3f4;
            color: #202124;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        #addToWhitelist:hover {
            background: #e3e3e3;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
            transform: translateY(-1px);
        }

        /* 名单列表样式 */
        .lists-container {
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #e0e0e0;
            overflow: visible;
            margin-bottom: 0;
        }

        .lists-section {
            margin-bottom: 24px;
        }

        .list-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }

        .list-header h2 {
            font-size: 16px;
            margin: 0;
            color: #202124;
        }

        .list-count {
            background: #e8f0fe;
            color: #1a73e8;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }

        .list-item {
            padding: 8px 12px;
            background: #f8f9fa;
            border-radius: 6px;
            margin-bottom: 8px;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            word-break: break-all;
        }

        .item-info {
            flex: 1;
            min-width: 0;
            margin-right: 8px;
            overflow: hidden;
        }

        .item-url {
            display: block;
            color: #5f6368;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .item-url-container {
            position: relative;
            width: 100%;
        }

        .edit-input {
            width: 100%;
            box-sizing: border-box;
            padding: 2px 4px;
            font-size: 12px;
        }

        .item-actions {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }

        .action-btn {
            width: 20px;
            height: 20px;
            padding: 2px;
            flex-shrink: 0;
        }

        .edit-btn {
            color: #1a73e8;
        }

        .remove-btn {
            color: #dc3545;
        }

        /* 空列表样式 */
        .empty-list {
            text-align: center;
            padding: 8px;
            color: #666;
            font-style: italic;
            background: #f8f9fa;
            border-radius: 6px;
            font-size: 12px;
            margin-bottom: 8px;
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .container {
            animation: fadeIn 0.3s ease-out;
        }

        .list-header-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .clear-list-btn {
            width: 20px;
            height: 20px;
            padding: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            background: transparent;
            color: #5f6368;
            opacity: 0.6;
            transition: all 0.2s ease;
        }

        .clear-list-btn:hover {
            opacity: 1;
            background: rgba(0, 0, 0, 0.05);
            color: #dc3545;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>宽屏优化器</h1>
        
        <div class="mode-switch">
            <input type="checkbox" id="modeToggle">
            <div class="mode-slider"></div>
            <div class="mode-labels">
                <label class="mode-label" for="modeToggle">全局模式</label>
                <label class="mode-label" for="modeToggle">局部模式</label>
            </div>
        </div>

        <div class="control-group">
            <label for="maxWidth">最大宽度 (px)</label>
            <input type="number" id="maxWidth" min="500" max="2000" step="50" value="1100">
        </div>

        <div class="control-button-group">
            <button id="addToOptimizeList">添加到优化名单</button>
            <button id="addToWhitelist">添加到白名单</button>
        </div>

        <div class="lists-container">
            <div class="lists-section">
                <div class="list-header">
                    <h2>优化名单</h2>
                    <div class="list-header-actions">
                        <span class="list-count optimize-count">0</span>
                        <button class="clear-list-btn" data-type="optimizeList">
                            <svg viewBox="0 0 24 24" width="16" height="16">
                                <path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
                            </svg>
                        </button>
                    </div>
                </div>
                <div class="optimize-list"></div>
            </div>
            <div class="lists-section">
                <div class="list-header">
                    <h2>白名单</h2>
                    <div class="list-header-actions">
                        <span class="list-count whitelist-count">0</span>
                        <button class="clear-list-btn" data-type="whitelist">
                            <svg viewBox="0 0 24 24" width="16" height="16">
                                <path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
                            </svg>
                        </button>
                    </div>
                </div>
                <div class="whitelist-list"></div>
            </div>
        </div>
    </div>
    <script src="popup.js"></script>
</body>
</html> 